package cn.itcast.hiss.server.order;

import cn.itcast.hiss.server.mapper.GoodsMapper;
import cn.itcast.hiss.server.util.SpringContextHolder;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
import org.springframework.context.ApplicationContext;

/*
 * @author miukoo
 * @description 库存分析
 * @date 2023/8/23 17:26
 * @version 1.0
 **/
public class StockServiceTask implements JavaDelegate {

    @Override
    public void execute(DelegateExecution execution) {
        ApplicationContext applicationContext = SpringContextHolder.getApplicationContext();
        GoodsMapper goodsMapper = applicationContext.getBean(GoodsMapper.class);
        int count = goodsMapper.countGoods();
        // 设置需要采购的商品数量
        execution.setVariable("goodSize",count);
    }

}
